<?php


namespace app\common\model\manystore;


use think\Model;

class MonitorInfo extends Model
{

    // 表名,不含前缀
    protected $name = 'manystore_monitor_info';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;
    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    // 追加属性
    protected $append = [
        'type_text'
    ];

    public function getTypeTextAttr($value,$data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function getTypeList()
    {
        return ['1' => __('教室'), '2' => __('寝室'), '3' => __('食堂'), '4' => __('操场'), '5' => __('大门')];
    }
}